<?php
    header("Content-type: application/json;charset=utf-8");
    $name = isset($_GET["nickname"])?$_GET["nickname"]:"";
    $result =array();

    $result["error"] = 0;

    try {        
            if($name == "1" ){
                throw new Exception("名称已存在"); 
            }
            if( $name == "" ){       
                throw new Exception("名称不能为空");   
            }

    }catch(Exception $e){
             $result["error"] = 1;
            $result["errmsg"] = $e->getMessage();
    }



       
    echo json_encode($result);